const express = require('express');
const router = express.Router();
const multer = require('multer');
const path = require('path');

const fileService = require("../service/fileService")

// 上传图片
router.post('/upLoad', multer({
    dest: path.join(__dirname, '../file/avatar') //设置文件的存储路径
}).single('file'), fileService.upLoad);

// 更新图片
router.post('/upData', multer({
    dest: path.join(__dirname, '../file/avatar') //设置文件的存储路径
}).single('file'), fileService.upLoad);

// 下载图片
router.get('/download/:name', fileService.download);

// 删除
router.post('/delete', fileService.delete);





module.exports = router;
